<?php

namespace app\controller\api;

use app\BaseController;
use app\logic\MessageLogic;

class Message extends BaseController
{
    public function send()
    {
        $data = $this->getData(['uid', 'type', 'content'], ['uid' => 'require|number', 'type' => 'require|in:1,2,3,4,5', 'content|消息' => 'require|max:120']);
        $user = $this->request->__get('user');
        MessageLogic::send($data, $user);
        \Api::success();
    }

    public function send_group()
    {
        $data = $this->getData(['group_id', 'type', 'content'], ['group_id' => 'require|number', 'type' => 'require|in:1,2,3,4,5', 'content|消息' => 'require|max:120']);
        $user = $this->request->__get('user');
        MessageLogic::send_group($data, $user);
        \Api::success();
    }
}